import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '级别',
    align: "center",
    dataIndex: 'gradeName'
  },
  {
    title: '积分',
    align: "center",
    sorter: true,
    dataIndex: 'gradeValue'
  },
  {
    title: '右边界',
    align: "center",
    sorter: true,
    dataIndex: 'maxValue'
  },
  {
    title: '级别logo',
    align: "center",
    dataIndex: 'gradePic',
    customRender: render.renderImage,
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '级别',
    field: 'gradeName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入级别!'},
             ];
    },
  },
  {
    label: '积分',
    field: 'gradeValue',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入积分!'},
             ];
    },
  },
  {
    label: '右边界',
    field: 'maxValue',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入右边界!'},
             ];
    },
  },
  {
    label: '级别logo',
    field: 'gradePic',
    component: 'JImageUpload',
    componentProps:{
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入级别logo!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  gradeName: {title: '级别',order: 0,view: 'text', type: 'string',},
  gradeValue: {title: '积分',order: 1,view: 'number', type: 'number',},
  maxValue: {title: '右边界',order: 2,view: 'number', type: 'number',},
  gradePic: {title: '级别logo',order: 3,view: 'image', type: 'string',},
};
